package com.moon.game.command.guest.lair;

import java.util.ArrayList;
import java.util.List;

import com.moon.game.command.BaseCmd;
import com.moon.game.command.RequestSession;
import com.moon.game.constants.Constants;
import com.moon.game.exception.GException;
import com.moon.game.vos.PlayerVo;
import com.moon.game.vos.PlayerVo.Tower;

/**
 * @description 查看我的孵化塔
 * @author Ranger 作者 E-mail:haozi000005@163.com
 * @version 创建时间：2012-7-12 下午3:05:05
 */
public class ShowMyLairCmd extends BaseCmd{

	@Override
	protected void runOnce(RequestSession req) throws GException {
		switch (req.getStatus()) {
		case STATU_INIT:
			doInit(req);
			break;
		case STATU_CHECK:
			doCheckSelf(req);
			break;
		case STATU_RETURN:
			doResponse(req);
			break;
		default:
			break;
		}
	}

	@Override
	protected void doResponse(RequestSession req) throws GException {
		PlayerVo player = req.getPlayer();
		List<Tower> towers = player.getTowerList();
		if (towers == null) {
			towers = new ArrayList<Tower>();
		}
		
		req.setVO("towers", towers);
		//返回孵化塔最大数量
		req.setVO("max_lair_num", Constants.MAX_TOWER_NUM);
		//返回
		response(req, req.getClientResponse());
	}
}
